<?php 
	$_product = $this->getProduct(); 
	$galleryImages = $_product->getMediaGalleryImages();
	$_pro_id = $_product->getId();
?>
<article class="tooltip-left <?php if(count($galleryImages) > 3) echo 'has-slide'?>">
	<figure class="tooltip-main-image" style="text-align:center">
		<a class="main_image_<?php echo $_pro_id?>" href="javascript:void(0);" title="<?php echo $this->htmlEscape($this->getImageLabel())?>">
			<img height="200" src="<?php echo $this->helper('catalog/image')->init($_product, 'image')->resize(355, 200)?>" alt="<?php echo $this->htmlEscape($this->getImageLabel())?>" title="<?php echo $this->htmlEscape($this->getImageLabel())?>">
		</a>
	</figure>	
	<input type="hidden" id="tooltipMoreviewCount-<?php echo $_product->getId()?>" value="<?php echo count($galleryImages)?>"/>
	<div class="tooltip-more-view">
		<?php if(count($galleryImages) > 3):?>
			<div class="button-left" id="scroll-left-<?php echo $_product->getId()?>">
				<a title="Left" href="#"><img src="<?php echo $this->getSkinUrl('images/button-left.png')?>" alt="Button"/></a>
			</div>
		<?php endif;?>			
		 <div id="tooltipSlideContainer-<?php echo $_product->getId()?>" class="tooltipSlideContainer">
			<ul id="<?php if(count($galleryImages) < 3) echo 'tooltipnoslide-'.$_product->getId();?>" class="<?php if(count($galleryImages) > 3) echo 'tooltipslide'; else echo 'tooltipnoslide';?>">
			<?php $i=0;foreach ($galleryImages as $_image): ?>
				<li style="text-align:center;" <?php if($i == count($galleryImages) - 1):?>class="last"<?php endif?>>
					<?php if($_image->getFile() == $_product->getImage()):?>
						<input type="hidden" id="baseIndex_<?php echo $_product->getId()?>" value="<?php echo $i?>"/>
					<?php endif?>
					<a class="chose_image_<?php echo $_pro_id;?> choose_image" data-fancybox-group="thumb" data-position="<?php echo $i?>" simg="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(355, 200)?>" href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())?>" title="<?php echo $this->htmlEscape($this->getImageLabel()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(112, 70); ?>" height="70" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" /></a>
				</li>
				<?php $i++?>
			<?php endforeach; ?>
			</ul>
		</div>
		<?php if(count($galleryImages) > 3):?>
			<div class="button-right" id="scroll-right-<?php echo $_product->getId()?>">
				<a title="Right" href="#"><img src="<?php echo $this->getSkinUrl('images/button-right.png')?>" alt="Button"/></a>
			</div>
		<?php endif;?>
	</div>
</article>
<article class="tooltip-right">
	<div class="product-name">
		<h1><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_product->getName()?>"><?php echo $this->htmlEscape($this->helper('core/string')->truncate($_product->getName(), 20));?></a></h1>
	</div>
	<?php echo $this->getPriceHtml($_product);?>
	<div class="actions">
		<?php if($_product->isAvailable()):?>
		<p class="added-notify added-notify-popup" id="an-popup-<?php echo $_product->getId()?>"></p>
		<div class="increase">
			<input type="text" readonly="readonly" id="qty-popup-<?php echo $_product->getId()?>" value="1"/>
			<span class="up pointer" onclick="increaseQty(false, true, false, <?php echo $_product->getId()?>, <?php echo $this->helper('gtgobbler/catalog')->getMaxIncreaseQty($_product)?>)">up</span>
			<span class="down pointer" onclick="decreaseQty(false, true, false, <?php echo $_product->getId()?>, true)">down</span>
		</div>
			<?php if ($_product->getTypeInstance(true)->hasOptions($_product)):?>
				<button style="width: 168px;" id='mc-popup-<?php echo $_product->getId()?>' class="button arrow-down mcbutton"><span><span>more choices</span></span></button>
				<?php $configurableAttributes = $_product->getTypeInstance(true)->getConfigurableAttributesAsArray($_product)?>
				<div class="select-flavour-container-list" id="flavourc-popup-<?php echo $_product->getId()?>">
				<?php foreach($configurableAttributes as $attribute):?>					
					<table>
						<col />
						<col width="35"/>
						<tbody>
							<?php $f=1;$count=count($attribute['values']);foreach($attribute['values'] as $value):?>
							<?php
								$childProduct = $_product->getTypeInstance(true)->getProductByAttributes(array($attribute['attribute_id'] => $value['value_index']), $_product);
								$childProduct = Mage::getModel('catalog/product')->load($childProduct->getId());
								if(!$childProduct->isSaleable()) 
									continue;
							?>
							<tr <?php if($f == $count) echo 'class="last"'?> onclick="addToCartAjax(<?php echo $_product->getId()?>, false, true, false, <?php echo $attribute['attribute_id']?>, <?php echo $value['value_index']?>)">												
								<td class="label">													
									<?php echo $value['label']?>													
								</td>
								<td class="addto">
									<span>add to</span>
									<span class="big">cart</span>
								</td>												
							</tr>
							<?php $f++?>
							<?php endforeach?>
						</tbody>
					</table>					
				<?php endforeach?>
				</div>
			<?php else:?>
			<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="addToCartAjax(<?php echo $_product->getId()?>, false, true)"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
			<?php endif?>
		<?php else:?>
			<p class="availability out-of-stock">
				<span>Sold Out</span>
			</p>
		<?php endif?>
	</div>
	<?php 
		$desc = $_product->getShortDescription();
		$showReadmore = false;
		if(strlen($desc) > 250){
			$showReadmore = true;
			$desc = $this->helper('core/string')->truncate($desc, 200);
		}
	?>
	<div class="tooltip-desc">
		<?php echo $this->htmlEscape($desc)?><?php if($showReadmore):?><a href="<?php echo $_product->getProductUrl() ?>" style="color: #bc92db;"> read more</a><?php endif?>
	</div>	
	<div class="share">
		<button class="button no-arrow share sharefriend-button" id="share-button-<?php echo $_product->getId()?>"><span><span>share via email</span></span></button>		
	</div>
	<?php if($_product->isAvailable()):?>
	<p class="bottom-availability">In stock</p>
	<?php else:?>
	<p class="bottom-availability">Out Stock</p>
	<?php endif?>
</article>
